﻿Public Class RseguimientoCreditoHip

    Public Shared Function SeleccionarTodoXEntidadFin(ByVal descEmpresa As String, ByVal pSeparacionVenta As EseparacionVenta) As List(Of EseguimientoCreditoHip)
        Dim seguimientoCreditoHips As List(Of EseguimientoCreditoHip) = Nothing

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                seguimientoCreditoHips = DseguimientoCreditoHip.SeleccionarTodoXEntidadFin(descEmpresa, pSeparacionVenta)
                If seguimientoCreditoHips Is Nothing Then seguimientoCreditoHips = New List(Of EseguimientoCreditoHip)
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return seguimientoCreditoHips
    End Function
    Public Shared Function EditarInstanciasCreditoHip(ByVal descEmpresa As String, ByVal pSeguimientoCreditoHip As EseguimientoCreditoHip) As Boolean
        Dim resultado As Boolean = False

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                resultado = DseguimientoCreditoHip.EditarInstanciasCreditoHip(descEmpresa, pSeguimientoCreditoHip)
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return resultado
    End Function

    '-------    TEMPORAL     --------'
    Public Shared Function SeleccionarTodoXEntidadFinTemp(ByVal descEmpresa As String, ByVal pSeparacionVenta As EseparacionVenta) As List(Of EseguimientoCreditoHip)
        Dim seguimientoCreditoHips As List(Of EseguimientoCreditoHip) = Nothing

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                seguimientoCreditoHips = DseguimientoCreditoHip.SeleccionarTodoXEntidadFinTemp(descEmpresa, pSeparacionVenta)
                If seguimientoCreditoHips Is Nothing Then seguimientoCreditoHips = New List(Of EseguimientoCreditoHip)
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return seguimientoCreditoHips
    End Function
    Public Shared Function EditarInstanciasCreditoHipTemp(ByVal descEmpresa As String, ByVal pSeguimientoCreditoHip As EseguimientoCreditoHip) As Boolean
        Dim resultado As Boolean = False

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                resultado = DseguimientoCreditoHip.EditarInstanciasCreditoHipTemp(descEmpresa, pSeguimientoCreditoHip)
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return resultado
    End Function

    '------------- TECHO PROPIO ---------------
    Public Shared Function SeleccionarTodoInstanciasTP(ByVal descEmpresa As String, ByVal pSeparacionVenta As EseparacionVenta) As List(Of EseguimientoCreditoHip)
        Dim seguimientoCreditoHips As List(Of EseguimientoCreditoHip) = Nothing

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                seguimientoCreditoHips = DseguimientoCreditoHip.SeleccionarTodoInstanciasTP(descEmpresa, pSeparacionVenta)
                If seguimientoCreditoHips Is Nothing Then seguimientoCreditoHips = New List(Of EseguimientoCreditoHip)
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return seguimientoCreditoHips
    End Function

    Public Shared Function EditarInstanciasTechoPropio(ByVal descEmpresa As String, ByVal pSeguimientoCreditoHip As EseguimientoCreditoHip) As Boolean
        Dim resultado As Boolean = False

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                resultado = DseguimientoCreditoHip.EditarInstanciasTechoPropio(descEmpresa, pSeguimientoCreditoHip)
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return resultado
    End Function

End Class
